<?php


namespace app\admin\model;

class ProjectsLayoutDrawings extends Base
{
    /**
     * Desc: 处理百度图文提取的数据，并保存
     * User: 苏鹏
     * Date: 2023/11/1
     * Time: 14:41
     * @return void
     */
    public function addLayoutDraw(array $data)
    {
        $layout = [];
        $deatil = [];
        if(!empty($data['words_result']))
        {
            $words = $data['words_result'];
            //排料图纸信息
            $layout['name'] = $words[5]['words']; //名称
            //厚度
            $thickness = explode ('x', $words[9]['words']);
            $thickness = end($thickness);
            $layout['thickness'] = $words[9];
            //重量
            $layout['weight'] = $words[16]['words'];
            //数量
            $layout['number'] = intval($words[2]['words']);
            //材质
            $layout['material'] = $words[19]['words'];
            //尺寸
            $layout['size'] = $words[8]['words'].$words[9]['words'];
            //利用率
            $layout['utilization_rate'] = $words[27]['words'];

            //明细信息


            try{
                $this->startTrans();


                $this->commit();
            }catch (\Exception $e){
                $this->rollback();
                return re_error_json($e->getMessage());
            }
        }


    }
}